package cn.com.hhrcw.login;

import org.apache.commons.lang.RandomStringUtils;

/**
 * @author lixingxing
 */
public abstract class AbstractLogin<E> {

    protected String username;

    protected String password;

    protected String token;

    protected AbstractLogin(String username, String password) {
        this.username = username;
        this.password = password;
    }

    /**
     * 登陆逻辑处理
     *
     * @return
     */
    public abstract Object login();

    /**
     * 登陆成功后执行
     *
     * @param obj
     * @return
     */
    public void success(E obj) {

    }

    /**
     * 签名秘钥
     *
     * @return
     */
    public String getSecret() {
        return RandomStringUtils.randomAlphanumeric(8);
    }

    public String getUsername() {
        return username;
    }

    public String getPassword() {
        return password;
    }

    public void setToken(String token) {
        this.token = token;
    }
}